package com.jdk.demo.reflect.clazz;

import java.lang.reflect.Constructor;

import com.jdk.demo.reflect.User;

public class ConstructorNewInstance {
	
	public static void main(String[] args) throws Exception {
		Class<?> c = Class.forName("com.jdk.demo.reflect.User");
		Constructor con = c.getConstructor(new Class[] {String.class, Integer.class});
		con.setAccessible(true);
		User u = (User)con.newInstance(new Object[] {"zsl", 123});
		System.out.println(u.getName());
	}

}
